//
//  GJResult.m
//  xmgjAppFront
//
//  Created by Zeki on 2020/7/8.
//  Copyright © 2020 guojutech. All rights reserved.
//

#import "GJResult.h"

@implementation GJResult
+ (instancetype)createInstance {
    return [GJResult instanceWithSuccess:NO message:@"未知错误" successData:nil];
}

+ (instancetype)instanceWithMessage:(NSString *)message {
    return [GJResult instanceWithSuccess:NO message:message successData:nil];
}

+ (instancetype)instanceWithResponse:(GJResponse *)response {
    return [GJResult instanceWithSuccess:response.isSuccess
                                 message:response.msg
                             successData:response.data
                                    code:response.code];
}

+ (instancetype)instanceWithSuccess:(BOOL)success message:(NSString *)message successData:(id)successData {
    return [GJResult instanceWithSuccess:success message:message successData:successData code:nil];
}

+ (instancetype)instanceWithSuccess:(BOOL)success message:(NSString *)message successData:(id)successData code:(NSString *)code {
    GJResult *result = [GJResult new];
    result.isSuccess = success;
    result.message = message;
    result.successData = successData;
    result.code = code;
    return result;
}
@end
